import 'dart:convert';

import 'package:flutter/material.dart';

//列表Item布局
class GridItemView extends StatelessWidget {
  GridItemView(this.position, this.json, {Key? key}) : super(key: key);

  int position;
  String json;

  @override
  Widget build(BuildContext context) {
    var data = jsonDecode(json);
    return Container(
      decoration: BoxDecoration(
          border: Border(
              bottom: BorderSide(color: Colors.white.withOpacity(0.22)),
              right: (position + 1) % 3 != 0
                  ? BorderSide(color: Colors.white.withOpacity(0.22))
                  : BorderSide(width: 0))),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text(
            data['name'],
            style: TextStyle(color: Color(0xff9F9F9F), fontSize: 12),
          ),
          SizedBox(
            height: 6,
          ),
          Text(
            data['value'].toString(),
            style: TextStyle(
                color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
          )
        ],
      ),
    );
  }
}
